package pk.nak.overlays;

import java.util.ArrayList;


import android.app.AlertDialog;
import android.content.Context;

import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;


public class EatOutItemizedOverlay extends ItemizedOverlay<EatOutOverlayItem> {

	private ArrayList<EatOutOverlayItem> mOverlays = new ArrayList<EatOutOverlayItem>();
	private Context mContext;
	public EatOutItemizedOverlay(Drawable defaultMarker,Context cxt) {
		super(boundCenterBottom(defaultMarker));
		this.mContext = cxt;
		// TODO Auto-generated constructor stub
	}

	@Override
	protected boolean onTap(int index) {
		EatOutOverlayItem item = this.mOverlays.get(index);
		AlertDialog.Builder dialog = new AlertDialog.Builder(this.mContext);
		dialog.setTitle(item.getTitle());
		dialog.setMessage(item.getSnippet());
		dialog.show();
		return true;
	}

	public void addOverlay(EatOutOverlayItem eooi){
		this.mOverlays.add(eooi);
		this.populate();
	}
	@Override
	protected EatOutOverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return this.mOverlays.get(i);
	}

	@Override
	public int size() {
		// TODO Auto-generated method stub
		return this.mOverlays.size();
	}

}
